home *** CD-ROM | disk | FTP | other *** search
Wrap
/***************************************************************************** Author : Matthew Stroup Description: Command line parser for Amiga v2600 Date : April 24, 1997 This file is part of v2600, the Atari 2600 Emulator =================================================== Copyright 1996 Alex Hornby. For contributions see the file CREDITS. This software is distributed under the terms of the GNU General Public License. This is free software with ABSOLUTELY NO WARRANTY. See the file COPYING for details. ******************************************************************************/ /* Command Line Option Parser */ #include "config.h" #include "options.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "version.h" /* Options common to all ports of x2600 */ extern struct BaseOptions base_opts={1,0,0,0,0,"",0,0,1,0,0}; static void copyright(void) { printf("\nVirtual 2600 Version %s.\nCopyright 1995/6 Alex Hornby.\n\nDistributed under the terms of the GNU General public license.\n",VERSION); printf("Virtual 2600 comes with ABSOLUTELY NO WARRANTY; for details see file COPYING.\nThis is free software, and you are welcome to redistribute it under\ncertain conditions.\n\n"); } static void base_usage(void) { printf("usage: v2600 [options] filename\nwhere options include:\n"); printf(" -h This information\n"); printf(" -v Show the current version/copyright info\n"); printf(" -f int Set the refresh rate (1=default)\n"); printf(" -n Emulate an NTSC 2600 (default)\n"); printf(" -p Emulate a PAL 2600\n"); printf(" -l <type> Left controller, 0=JOY (default), 1=PADDLE\n"); printf(" -r <type> Right controller, 0=JOY (default), 1=PADDLE\n"); printf(" -b <type> Bank switching scheme, 0=NONE (default),1=Atari 8k,\n"); printf(" 2=Atari 16k, 3=Parker 8k, 4=CBS, 5=Atari Super Chip\n"); printf(" -s Turn on sound.\n"); printf(" -S Turn off sound. (default)\n"); printf(" -w Swap the left and right control methods.\n"); printf(" -j Use real joysticks. (default)\n"); printf(" -k Use keyboard for joystick.\n"); printf(" -y Use mouse y for paddle (e.g. video olympics).\n"); printf(" -V Video output, 0=Custom Screen (default), 1=Window\n"); printf(" 2='Fast but Ugly' Custom Screen\n"); } int parse_options(int argc, char **argv) { int n=1; if (argc==1) { copyright(); base_usage(); exit(0); } while(argv[n][0]=='-') { switch (argv[n][1]) { case 'h': copyright(); base_usage(); exit(0); break; case 'v': copyright(); exit(0); break; case 'f': base_opts.rr=atoi(argv[n+1]); n++; break; case 'n': base_opts.tvtype=0; break; case 'p': base_opts.tvtype=1; break; case 'l': base_opts.lcon=atoi(argv[n+1]); n++; break; case 'r': base_opts.rcon=atoi(argv[n+1]); n++; break; case 'b': base_opts.bank=atoi(argv[n+1]); n++; break; case 's': base_opts.sound=1; break; case 'S': base_opts.sound=0; break; case 'w': base_opts.swap=1; break; case 'j': base_opts.realjoy=1; break; case 'k': base_opts.realjoy=0; break; case 'y': base_opts.mousey=1; break; case 'V': base_opts.video=atoi(argv[n+1]); n++; break; default: fprintf (stderr,"\n'%s' is not valid or is not a supported option.\n", argv[n]); } n++; } if (n<argc) strcpy(base_opts.filename, argv[n]); else { printf("No filename was specified.\n"); exit(0); } return 0; }